package com.test.kotlin03

import kotlin.math.roundToInt


fun numberTest(){
//    val number1 :Int = "8.98".toInt()//double 转换出错
    val number2:Int ?= "8.98".toIntOrNull()//null
    println(number2)

    println(8.956756.toInt())//8
    println(8.956756.roundToInt())//9

    val s = "%.2f".format(8.123456)//8.12
    println(s)
}

fun main(){
    numberTest()
}